package com.shrct.businessprocess.product.impl;

import com.shrct.businessprocess.product.RCIdentifiableNormalProductEntry;
import com.shrct.businessprocess.product.RCIdentifiableNormalProductEntryEvent;
import com.shrct.businessprocess.product.impl.RCIdentifiableNormalProductEntryImpl;
import com.shrct.businessprocess.product.impl.RCProductEventImpl;
import com.shrct.businessprocess.product.proxy.RCIdentifiableNormalProductEntryEventProxy;
import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

@Entity
@DiscriminatorValue("RCIDENTIFIABLENORMALPRODUCTENTRYEVENT_TYPE")
public abstract class RCIdentifiableNormalProductEntryEventImpl extends RCProductEventImpl implements RCIdentifiableNormalProductEntryEvent {
  public RCIdentifiableNormalProductEntryEventImpl() {
    super();
  }
  
  public RCIdentifiableNormalProductEntryEventImpl(final RCIdentifiableNormalProductEntry product) {
    super();
    this.product = product;
  }
  
  @JoinColumn(name = "product_id")
  @ManyToOne(targetEntity = RCIdentifiableNormalProductEntryImpl.class, cascade = { CascadeType.MERGE, CascadeType.PERSIST })
  private RCIdentifiableNormalProductEntry product;
  
  public RCIdentifiableNormalProductEntry getProduct() {
    return this.product;
  }
  
  public RCIdentifiableNormalProductEntryEvent setProduct(final RCIdentifiableNormalProductEntry product) {
    this.product = product;
    return this;			
    
  }
  
  public RCIdentifiableNormalProductEntryEventProxy toProxy() {
    com.shrct.businessprocess.product.proxy.RCIdentifiableNormalProductEntryEventProxy proxy = new com.shrct.businessprocess.product.proxy.RCIdentifiableNormalProductEntryEventProxy();
    proxy.setId(this.getId());
    if(this instanceof edu.fudan.mylang.pf.INamedModelObject){
    	proxy.setName(((edu.fudan.mylang.pf.INamedModelObject)this).getEntityName());
    }
    return proxy;
    
  }
}
